<template>
	<view class="contain">
		<rich-text :nodes="articleMsg.ChineseSubstance"></rich-text>
	</view>
</template>

<script>
	import { getChildren } from '@/api/homePage.js'
	export default{
		data(){
			return{
				articleMsg:'',
			}
		},
		methods:{
			async getDetail(id){
				try{
					uni.showLoading();
					const { Data } =await getChildren({
						ArticleCategoryId:id,
						Index:1,
						Size:10
					})
					uni.hideLoading();
					console.log(Data)
					if(Data.length==0){
						uni.showToast({
							title:'暂无任何内容！',
							icon:'none'
						})
					}else{
						const regex = new RegExp('<static', 'gi');
						Data[0].ChineseSubstance= Data[0].ChineseSubstance.replace(regex, `<img style="width: 100%;height:200px;"`);
						this.articleMsg=Data[0];
					}
					// console.log('this.articleMsg222',Data[0]);

				}catch(e){
					//TODO handle the exception
				}
			}
		},
		onLoad(option) {
			this.getDetail(option.id)
		}
	}
</script>

<style lang="scss" scoped>
	.contain{
		padding: 20rpx 40rpx 80rpx;
		overflow: hidden;
	}
</style>
